<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body id="body">
<table id="table1" border="1">
  <tr>
    <td colspan="10">data</td>
    <th scope="colgroup" colspan="5">col head</td>a
    <td colspan="2">data</td>
  </tr>
</table>
<table id="table2" border="1">
  <tr>
    <td rowspan="2" colspan="3">data</td>
    <th scope="colgroup" colspan="2">col head</th>
  </tr>
  <tr>
    <th scope="col">col head</th>
    <th scope="col">col head</th>
  </tr>
</table>
<p id="description"></p>
<div id="console"></div>

<script>

    description("Check whether cells with colspan are reported properly");

    if (window.accessibilityController) {
        var table1 = accessibilityController.accessibleElementById("table1");
        shouldBe("table1.columnCount", "3");

        var cell_0_0 = table1.cellForColumnAndRow(0, 0);
        shouldBe("cell_0_0.role", "'AXRole: AXCell'");
        shouldBe("cell_0_0.columnIndexRange()", "'{0, 1}'");

        var cell_0_1 = table1.cellForColumnAndRow(1, 0);
        shouldBe("cell_0_1.role", "'AXRole: AXColumnHeader'");
        shouldBe("cell_0_1.columnIndexRange()", "'{1, 1}'");

        var cell_0_2 = table1.cellForColumnAndRow(2, 0);
        shouldBe("cell_0_2.role", "'AXRole: AXCell'");
        shouldBe("cell_0_2.columnIndexRange()", "'{2, 1}'");

        var table2 = accessibilityController.accessibleElementById("table2");
        shouldBe("table2.columnCount", "3");
        shouldBe("table2.columnHeadersCount", "3");

        var cell_0_1 = table2.cellForColumnAndRow(1, 0)
        shouldBe("cell_0_1.columnIndexRange()", "'{1, 2}'");
        var cell_0_2 = table2.cellForColumnAndRow(2, 0);
        shouldBe("cell_0_2.columnIndexRange()", "'{1, 2}'");
        shouldBeTrue("table2.columnHeaderAtIndex(0).isEqual(cell_0_1)")
        shouldBeTrue("table2.columnHeaderAtIndex(0).isEqual(cell_0_2)");
        shouldBeTrue("table2.columnHeaderAtIndex(1).isEqual(table2.cellForColumnAndRow(1, 1))")
        shouldBeTrue("table2.columnHeaderAtIndex(2).isEqual(table2.cellForColumnAndRow(2, 1))");
    }

</script>

</body>
</html>
